phpunit test private function

36

/**
 	 * testBar
 	 *
 	 * @author	Joe Sexton <[email protected]>
 	 */
	public function testBar()
	{
		$number = 1;

		$object = new Foo();
		$reflector = new ReflectionClass( 'Foo' );
		$method = $reflector->getMethod( 'bar' );
		$method->setAccessible( true );

		$result = $method->invokeArgs( $object, array( $number ) );

		$this->assertEquals( 1, $result ); // whatever your assertion is

	}

Comments

Submit
0 Comments